#!/bin/bash

yum install -y wget

function download_from_china(){
wget http://mogu-lamp.qiniudn.com/mysql-5.5.40.tar.gz
wget http://mogu-lamp.qiniudn.com/apr-1.5.0.tar.gz
wget http://mogu-lamp.qiniudn.com/apr-util-1.5.3.tar.gz
wget http://mogu-lamp.qiniudn.com/httpd-2.4.10.tar.gz
wget http://mogu-lamp.qiniudn.com/libmcrypt-2.5.8.tar.gz
wget http://mogu-lamp.qiniudn.com/mhash-0.9.9.9.tar.gz
wget http://mogu-lamp.qiniudn.com/mcrypt-2.6.8.tar.gz
wget http://mogu-lamp.qiniudn.com/php-5.4.34.tar.gz
wget http://mogu-lamp.qiniudn.com/phpMyAdmin-3.5.8.1-all-languages.zip
wget http://mogu-lamp.qiniudn.com/APC-3.1.13.tgz
wget http://mogu-lamp.qiniudn.com/memcache-2.2.7.tgz
}

function download_from_us(){
wget http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.40.tar.gz
wget http://archive.apache.org/dist/apr/apr-1.5.0.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.5.3.tar.gz
wget http://archive.apache.org/dist/httpd/httpd-2.4.10.tar.gz
wget http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
wget http://nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
wget http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
wget http://us1.php.net/distributions/php-5.4.34.tar.gz
wget http://optimate.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.5.8.1/phpMyAdmin-3.5.8.1-all-languages.zip
wget http://pecl.php.net/get/APC-3.1.13.tgz
wget http://pecl.php.net/get/memcache-2.2.7.tgz
}

echo "==========================="

	china="y"
	echo "In China, Please input y or press Enter"
	echo "Not in China, Please input n"
	read -p "(Please input y or n):" china
	case "$china" in
	y|Y|Yes|YES|yes|yES|yEs|YeS|yeS)
	echo "The Source from China is downloading..."
	download_from_china
	;;
	n|N|No|NO|no|nO)
	echo "The Source from US is downloading..."
	download_from_us
	;;
	*)
	echo "The Source from China is downloading..."
	download_from_china
	esac
